<?php
   // ************************************************************************
   // **                                                                    **
   // **          This original software was designed and coded by          **
   // **                                                                    **
   // **                         David A. Goldsmith                         **
   // **                                                                    **
   // **                       dave106@wonderdave.com                       **
   // **                                                                    **
   // **                          March/April 2005                          **
   // **            Revised for Galileo High School, August 2009            **
   // **                                                                    **
   // ************************************************************************
?>


<html>
<title>Computer Lab Signup System</title>


<?php
   include("Configure.php");


   // In case the "register_globals" PHP directive is off, make sure all of the passed form variables are accessible
   $User =  mysql_real_escape_string($_POST['User']);
?>


<head>
   <meta http-equiv="Robots" content="none, noarchive">
   <meta http-equiv="Cache-Control" content="no-cache">
   <meta http-equiv="Pragma" content="no-cache">
   <meta http-equiv="Expires" content="-1">
</head>

<body onContextMenu="return false" onDragStart="return false" onSelectStart="return false">


<form name='LoginForm'
      method='post'
      action='Login.php'>
</form>


<?php
   $PageFrom = $_SERVER["HTTP_REFERER"];

   // For the teacher who is logging out (or being logged out), erase the teacher's session from the
   //  "LabSessions" table and send the teacher to the login page (Login.php)
   if (($User) and ($PageFrom == $URL_03))
   {
      $Query = mysql_query("DELETE FROM LabSessions WHERE Username='$User' LIMIT 1", $DB);
      echo "<body bgcolor='#000000' onLoad='document.LoginForm.submit()'>";
   }

   if ((! $User) or ($PageFrom != $URL_03))
      echo "<body bgcolor='#000000' onLoad=\"location.replace('index.html')\">";
?>


</body>

<head>
   <meta http-equiv="Robots" content="none, noarchive">
   <meta http-equiv="Cache-Control" content="no-cache">
   <meta http-equiv="Pragma" content="no-cache">
   <meta http-equiv="Expires" content="-1">
</head>

</html> 
